import { channels } from "@/api/index.js";
export default {
  namespaced: true,
  state: {
    list: [],
    currentId: "",
  },
  mutations: {
    SETLIST(s, val) {
      s.list = val;
    },
    SETCURRENTTID(s, val) {
      s.currentId = val;
    },
  },
  actions: {
    async getTypeList({ commit, dispatch }, id) {
      const {
        data: { data },
      } = await channels();
      // console.log(data);
      commit("SETLIST", data.channels);
      commit("SETCURRENTTID", data.channels[0].id);

      // ! 当 频道分类列表 获取完后再来获取 频道头条详情列表的
      dispatch("list/getInfoList", data.channels[0].id, { root: true });
    },
  },
};
